home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet multimedia / Animacje, filmy i prezentacje / Modelowanie 3D / K-3D 0.6.5.0 / k3d-all-in-one-setup-0.6.5.0.exe / k3d-setup-0.6.5.0.exe / share / shaders / k3d_functions.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-17  |  706 b   |  33 lines

  1. /* k3d_functions.h
  2.  * 
  3.  * various functions collected from k3d_*.sl files
  4.  *
  5.  * add #include "k3d_functions.h" to your .sl files to use
  6.  */
  7.  
  8.  
  9.  /*
  10.      * Basic Math
  11.      */
  12.      
  13. #define sqr(x) ((x)*(x))
  14.  
  15. #define isOdd(x) ((mod(x,2) == 1) ? 1 : 0)  /* also in rmnotes as odd(x) even(x) */
  16.     
  17.     /*
  18.      * finters steps and pulses
  19.      */
  20.      
  21. #define boxstep(a,b,x) clamp(((x)-(a))/((b)-(a)),0,1) /* also in rmnotes, but all that code will end up here anyway. */
  22.   
  23. #define smoothPulse(a, b, fuzz, loc)  (smoothstep (a-fuzz, a+fuzz, loc) - smoothstep (b-fuzz, b+fuzz, loc) )
  24.  
  25. /* separate fuzzes */
  26. #define smoothPulse2Fuzz(a, b, afuzz, bfuzz, loc)   (smoothstep (a-afuzz, a, loc) - smoothstep (b, b+bfuzz, loc))
  27.  
  28.     
  29.     
  30.  
  31.  
  32.  
  33.